// Toast组件模板
const toastTemplate = `
<div class="toast" id="toast"></div>
`;

// 渲染Toast组件
document.getElementById('toastComponent').innerHTML = toastTemplate;

// 显示Toast提示
function showToast(message, type = '') {
    const toast = document.getElementById('toast');
    toast.textContent = message;
    toast.className = 'toast ' + type;
    
    // 添加show类触发动画
    setTimeout(() => toast.classList.add('show'), 10);
    
    // 3秒后隐藏
    setTimeout(() => {
        toast.classList.remove('show');
    }, 3000);
}

// 成功提示
function showSuccess(message) {
    showToast(message, 'success');
}

// 错误提示
function showError(message) {
    showToast(message, 'error');
} 